package com.aspose.cells.a.d;

public class zgb {
   private static char[] a = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};

   public static boolean a(String var0) {
      return var0.indexOf(":/") > 0;
   }

   public static boolean b(String var0) {
      return c(var0) || d(var0);
   }

   public static boolean c(String var0) {
      return var0.length() > 2 && a(var0.charAt(0)) && var0.charAt(1) == ':' && var0.charAt(2) == '\\';
   }

   public static boolean d(String var0) {
      return var0.startsWith("\\\\");
   }

   private static boolean a(char var0) {
      return var0 >= 'a' && var0 <= 'z' || var0 >= 'A' && var0 <= 'Z';
   }

   public static String a(String var0, String var1) {
      if (!zcq.a(var0)) {
         return var1;
      } else {
         String var2;
         if (var0.indexOf("/") != -1) {
            var2 = "/";
         } else {
            var2 = "\\";
         }

         return var0.endsWith(var2) ? var0 + var1 : var0 + var2 + var1;
      }
   }

   public static boolean e(String var0) {
      return var0.startsWith("#");
   }

   public static String f(String var0) {
      return h(var0) ? g(var0) : var0;
   }

   public static String g(String var0) {
      StringBuilder var1 = new StringBuilder();

      for(int var2 = 0; var2 < var0.length(); ++var2) {
         char var3 = var0.charAt(var2);
         if (b(var3)) {
            var1.append(c(var3));
         } else {
            var1.append(var3);
         }
      }

      return com.aspose.cells.b.a.zr.a(var1);
   }

   private static boolean b(char var0) {
      return " <>{}|^[]`\"%".indexOf(var0) >= 0;
   }

   private static boolean h(String var0) {
      if (!zcq.a(var0)) {
         return false;
      } else if (!c(var0) && !d(var0)) {
         if (com.aspose.cells.b.a.zv.a(var0, " <>{}|^[]`\"".toCharArray()) >= 0) {
            return true;
         } else {
            for(int var1 = 0; var1 < var0.length(); ++var1) {
               if (var0.charAt(var1) == '%' && var1 + 2 < var0.length() && !i(var0.substring(var1, var1 + 3))) {
                  return true;
               }
            }

            return false;
         }
      } else {
         return false;
      }
   }

   private static boolean i(String var0) {
      if (var0.length() == 3 && var0.charAt(0) == '%' && zcq.b(var0.charAt(1)) && zcq.b(var0.charAt(2))) {
         return " <>{}|^[]`\"%".indexOf(j(var0)) >= 0;
      } else {
         return false;
      }
   }

   private static char j(String var0) {
      return (char)(zcq.a(var0.charAt(1)) * 16 + zcq.a(var0.charAt(2)));
   }

   private static String c(char var0) {
      StringBuilder var1 = new StringBuilder(3);
      var1.setLength(3);
      var1.setCharAt(0, '%');
      var1.setCharAt(1, a[(var0 & 240) >> 4]);
      var1.setCharAt(2, a[var0 & 15]);
      return com.aspose.cells.b.a.zr.a(var1);
   }
}
